/*
 * Мосты
 * vim:foldmethod=marker:
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>

#define N_MAX 20000
#define M_MAX 200000

#define DFS_TREE	(1 << 4)
#define DFS_NOT_TREE	(1 << 5)
#define DFS_TSORT_OK	5141
#define	DFS_TSORT_FAIL	2342
#define COLOR_WHITE	0
#define COLOR_GRAY	1
#define COLOR_BLACK	2

struct Node {
	int x;
	int8_t is_valid;
	int edge_i;
	Node *next;
};

struct adjlist {
	Node *first;
	Node *last;
	int8_t size;

	/* Other attributes */
	int	color;
	uint8_t	visited;
	int	distance;
	int	conn_sp_id;
	uint8_t	has_bridge;
};


static int _list[N_MAX + 1];
static int _list_idx; //points beyond the last meaningful record

static int _color[N_MAX];

static void
pushback(struct adjlist *al, int x, int edge_i)
{
	struct Node *newnode;
	newnode = (struct Node *) calloc(1UL, sizeof (struct Node));
	newnode->x        = x;
	newnode->is_valid = 1;
	newnode->edge_i   = edge_i;
	newnode->next     = NULL;
	if (!al->first)
		al->first = newnode;
	else
		al->last->next = newnode;
	al->last = newnode;
	al->size++;
}

static void
free_al(struct adjlist *al)
{
	struct Node *n, *p;
	p = n = al->first;
	while (n) {
		n = n->next;
		free(p);
		p = n;
	}
}

/* unneeded {{{
static int
dfs_chk_connection(struct adjlist * const al, const int start)
{
	Node *node = NULL;

	al[start].visited = 1;
	node = al[start].first;

	while (node) {
		if (!al[node->x].visited)
			dfs_chk_connection(al, node->x);
		node = node->next;
	}

	return (0);
}
*/

/*
static int
dfs_chk_cycles(struct adjlist * const al, const int start, const int sender,
		const int distance)
{
	int ret = 0;
	Node *nd = NULL;

	if (al[start].color == COLOR_GRAY)
		return (DFS_NOT_TREE);

	al[start].color   = COLOR_GRAY;
	nd                = al[start].first;

	while (nd) {
		if (nd->x == sender || al[nd->x].distance != distance - 1)
			goto cont;
		ret = dfs_chk_cycles(al, nd->x, start, distance + 1);
		if (ret == DFS_NOT_TREE)
			return (DFS_NOT_TREE);
		*//* if (ret == DFS_TREE) goto cont; *//*
cont:
		nd = nd->next;
	}

	al[start].color = COLOR_BLACK;

	return (DFS_TREE);
}

static int
dfs_topo_sort(struct adjlist * const al, const int start)
{
	Node *nd = NULL;
	int ret = 0;

	al[start].visited = 1;
	//al[start].conn_sp_id = conn_sp_id;
	al[start].color = COLOR_GRAY;
	nd = al[start].first;

	while (nd) {
		if (al[nd->x].color == COLOR_WHITE) {
			if ((ret = dfs_topo_sort(al, nd->x)) == DFS_TSORT_FAIL)
				return (DFS_TSORT_FAIL);
		} else if (al[nd->x].color == COLOR_GRAY) { //found a cycle
			return (DFS_TSORT_FAIL); //нужно конденсировать граф
		}
		nd = nd->next;
	}

	list[--list_idx] = start;
	al[start].color = COLOR_BLACK;

	return (DFS_TSORT_OK);
}

inline void
print_topo_sort_list(void)
{
	register int i;
	for (i = list_idx; i < N_MAX; i++)
		(void) printf("%d ", list[i] + 1);
	(void) putc('\n', stdout);
}
}}} */

static void
dfs_find_bridges_st1(struct adjlist * const al, const int start)
{
	Node *node = NULL;
	al[start].visited = 1;
	node = al[start].first;
	_list[_list_idx++] = start;
	while (node) {
		if (!al[node->x].visited) {
			node->is_valid = 0;
			dfs_find_bridges_st1(al, node->x);
		}
		node = node->next;
	}
}

static void
dfs_find_bridges_st2(struct adjlist * const al, const int start,
		const int color)
{
	Node *node = NULL;
	al[start].color = color;
	_color[start]   = color;
	node		= al[start].first;
	while (node) {
		if (node->is_valid &&
		    al[node->x].color == color)
			dfs_find_bridges_st2(al, node->x, color);
		node = node->next;
	}
}

static void
dfs_print_bridges(const struct adjlist * const al)
{
	register int i = 0;

	;
}

int
main(void)
{
	struct adjlist	*AL;
	int		n, m;
	int		i = 0;
	int		a, b;
	int		color = 1;
	int		edge_idx = 1;

	(void) scanf("%d %d", &n, &m);
	AL = (struct adjlist *) calloc(n, sizeof *AL);
	for (i = 0; i < m; i++) {
		(void) scanf("%d %d", &a, &b);
		--a,b--;
		pushback(AL + a, b, edge_idx);
		pushback(AL + b, a, edge_idx++);
	}
	dfs_find_bridges_st1(AL, a);
	for (i = 0; i < _list_idx ; i++)
		if (AL[_list[i]].color == 0)
			dfs_find_bridges_st2(AL, _list[i], color++);
	dfs_print_bridges(AL);
cleanup:
	for (i=0;i<n;i++)
		free_al(AL+i);
	free(AL);
	return 0;
}
